#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "heapsort.h"
#include "util.h"

//#define RANDOM_INPUT
#undef RANDOM_INPUT

int main(int argc, char *argv[])
{
    int n;
#if !defined(RANDOM_INPUT)
    //int a[] = {5, 3, 17, 10, 84, 19, 6, 22, 9};
    int a[] = {1, 2, 3};
    //int a[] = {4,1,3,2,16,9,10,14,8,7};
    n = sizeof(a) / sizeof(a[0]);
    print_a(a, n);
    build_max_heap(a, n);
    print_a(a, n);
#else
    int a[9], b[9], i;

    srand(time(NULL));
    for (i = 0; i < 9; i++)
    {
	a[i] = rand() % 100;
	b[i] = a[i];
    }
    n = sizeof(a) / sizeof(a[0]);

    print_a(a, n);
    //build_max_heap(a, n);
    heapsort(a,n);
    bubblesort(b, n);
    print_a(a, n);
    print_a(b, n);
#endif

    return 0;
}
